Add a spec for testing hub links in an RSS output

Akinori MUSHA 9 years ago
parent
commit
803796ed3f
1 changed files with 10 additions and 0 deletions
  1. 10 0
      spec/models/agents/data_output_agent_spec.rb

+ 10 - 0
spec/models/agents/data_output_agent_spec.rb

@@ -193,6 +193,16 @@ describe Agents::DataOutputAgent do
193 193
         XML
194 194
       end
195 195
 
196
+      it "can output RSS with hub links when push_hubs is specified" do
197
+        stub(agent).feed_link { "https://yoursite.com" }
198
+        agent.options[:push_hubs] = %w[https://pubsubhubbub.superfeedr.com/ https://pubsubhubbub.appspot.com/]
199
+        content, status, content_type = agent.receive_web_request({ 'secret' => 'secret1' }, 'get', 'text/xml')
200
+        expect(status).to eq(200)
201
+        expect(content_type).to eq('text/xml')
202
+        xml = Nokogiri::XML(content)
203
+        expect(xml.xpath('/rss/channel/atom:link[@rel="hub"]/@href').map(&:text).sort).to eq agent.options[:push_hubs].sort
204
+      end
205
+
196 206
       it "can output JSON" do
197 207
         agent.options['template']['item']['foo'] = "hi"
198 208